<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<script src="js/jquery-1.5.1.min.js"></script>
<script type='text/javascript'>
	var city;
	var language;
	function init(){
	$.ajax({
	type: "POST",
	url: "/json/ShowCountryCity.htm",
  	contentType: "application/json; charset=UTF-8",
 	dataType: "json",
	success: function(data) {
	var json = eval(data);
	city = data[1];
	language = data[2];
//	alert(json.length);
//	alert("------->进入当前的数据展现");
//	for(var i=0;i<data.length;i++){
		//	alert(data[i].length);
		for(var j=0;j<=data[0].length;j++){
			var g = data[0][j];
			$("#country").append("<option value='"+g.code+"'>"+g.name+"</option>");
		}
//	}
  },
	error:function(){
  	alert("异常，请稍候再试！");
  		}
	});
}
	function selectbycity(){
	var h=0;
	var temp = document.getElementById('country').value;
	document.getElementById('city').innerHTML="";//清空下拉框
	//alert(temp);
		for(var k in city){
			var code = city[k].countrycode;
			if(temp == code){
			h++
			$("#city").append("<option value='"+city[k].countrycode+"'>"+city[k].name+"</option>");
			}
		}
	//	alert(h);
	}
	
	function selectbylanguage(){
	var temp = document.getElementById('city').value;
	alert(temp);
	document.getElementById('language').innerHTML="";//清空下拉框
		for(var s in language){
			var code = language[s].countrycode;
			if(code == temp){
			$("#language").append("<option value='"+language[s].countrycode+"'>"+language[s].language+"</option>");
			}
		}
	//	alert(h);
	}

</script>
</head>
<body onload="init()">
	<select id="country" onchange="selectbycity()">
	<option value="">请选择</option>
	</select>
	<select id="city" onchange="selectbylanguage()">
   		<option value="">请选择</option>
    </select>
    <select id="language">
   		<option value="">请选择</option>
    </select>
</body>
</html>